from components.data_cleaning import cleaningData
from components.workflow_generate import analyze_add_workflow
from components.report_generate import generate_workflow_report

def main():
    # 读取日志文件
    # -----------------------------------------------------------------------------------
    # |   将需要分析的日志放入 statics 文件夹                                              |
    # |    file_name 字段改为需要分析的人脸日志文件名，即可启动 Main.py，提取相关日志内容     |
    # -----------------------------------------------------------------------------------
    file_name = 'mcu1.txt'

    with open(f'statics/{file_name}', 'r', encoding='utf-8') as f:
        log_data = f.read()

    # 解析日志
    df = cleaningData(log_data)

    # 分析工作流程
    workflow_df = analyze_add_workflow(df)

    # 生成报告
    report_df = generate_workflow_report(workflow_df)
    print("分析完成！报告已保存为 face_add_report.png 和 face_add_details.xlsx")

if __name__ == "__main__":
    main()